//
//  shoujniaTableViewCell.m
//  tongxiangOASystem
//
//  Created by michael on 2018/4/16.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "shoujniaTableViewCell.h"

@implementation shoujniaTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {

//        [self createUI];
self.contentView.backgroundColor = [UIColor colorWithHexString:@"efeff4"];
          self.selectionStyle = UITableViewCellSelectionStyleNone;
//    self.contentView.layer.borderWidth = 5;
//      UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.2];
//
//self.contentView.layer.borderColor = [myColor CGColor];
self.bgView  = [[UIView alloc]init];
       [self.contentView addSubview:_bgView];

     _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
    
      [_label1 setFont:[UIFont systemFontOfSize:13]];
//       [self.bgView addSubview:_label1];
    
       _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
    _label2.numberOfLines = 0;
      [_label2 setFont:[UIFont systemFontOfSize:14]];
       [self.bgView addSubview:_label2];
    
       _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectZero;
      [_label3 setFont:[UIFont systemFontOfSize:14]];
       [self.bgView addSubview:_label3];
 _button = [UIButton buttonWithType:UIButtonTypeCustom];
 [_button setImage:[UIImage imageNamed:@"单选-默认"] forState:UIControlStateNormal];
[_button setImage:[UIImage imageNamed:@"单选-选中"] forState:UIControlStateSelected];
//    [_button addTarget:self action:@selector(sendaction) forControlEvents:UIControlEventTouchUpInside];
    [self.bgView addSubview:_button];
    _image= [[UIImageView alloc]init];
        [self.bgView addSubview:_image];

}

return self;

}
- (void)layoutSubviews{
[super layoutSubviews];
     CGFloat  titleFloat  = [OAToolBox sizebyText:_dic[@"subject"] font:14 minsWidth:70+30];

self.bgView.frame =  CGRectMake(10, 5, KScreenWidth - 20, titleFloat+30);
    self.bgView.backgroundColor = [UIColor whiteColor];
         _button.frame  = CGRectMake(5, 5,30, 30);
if (_muarray.count>0) {
  for (NSString *string in _muarray) {
    if ([string isEqualToString:_dic[@"unid"]]) {
    _button.selected = YES;break;
}else{
_button.selected = NO;
}
}
}else{
_button.selected = NO;
}

_label2.frame =CGRectMake(_button.right+5, 5,kScreenWidth-70-30, titleFloat);
_label2.text = _dic[@"subject"] ;
_label2.textColor = [UIColor colorWithHexString:@"1870ca"];
           _image.frame  = CGRectMake(_label2.right+5, 5,30, 15);
           if ([[NSString stringWithFormat:@"%@",_dic[@"isnewmail"]]isEqualToString:@"1"]) {
    _image.image = [UIImage imageNamed:@"已读"];
_image.hidden = YES;
}else{
    _image.image = [UIImage imageNamed:@"未读"];
_image.hidden =  NO;
}
_label3.frame =CGRectMake(_button.right+5, _label2.bottom, kScreenWidth-70, 20);
//_label3.backgroundColor = [UIColor greenColor];
_label3.text = [NSString stringWithFormat:@"%@:  %@",_adic[@"file1"],_dic[@"file1"]];
_label3.textColor = [UIColor colorWithHexString:@"2c2c2c"];

//2c2c2c
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end

